<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>前端监控SDK</title>
</head>

<body>
    <div id="container">
        <div class="content">
            <input type="button" value="点击抛出错误" onclick="btnClick()" />
            <input type="button" value="点击抛出promise错误" onclick="btnPromiseClick()" />
            <input type="button" value="发起ajax成功请求" onclick="sendAjaxSuccess()" />
            <input type="button" value="发起ajax失败请求" onclick="sendAjaxError()" />
        </div>
    </div>
    
    <script>
        function btnClick(){
            window.someVariable.error = 'someVariable';
        }
        function btnPromiseClick() {
            new Promise(function (resolve, reject) {
                window.someVar.error = 'error';
                // reject('error')
            }).then(res=>{
                console.log(res)
            });
        }

        function sendAjaxSuccess() {
            let xhr = new XMLHttpRequest;
            xhr.open('GET','/success',true)
            xhr.responseType = 'json'
            xhr.onload = function () {
                console.log(xhr.response);
            }
            xhr.send();
        }
    </script>
    <!-- <script src="./error.js"></script> -->
</body>
</html>